package com.carter.springframework.beans.factory.config;

import com.carter.springframework.beans.exception.BeanException;

public interface InstantiationAwareBeanPostProcessor extends BeanPostProcessor{

    /**
     * bean实例化之前处理
     * @param beanClass
     * @param beanName
     * @return
     * @throws BeanException
     */
    Object postProcessBeforeInstantiation(Class<?> beanClass,String beanName) throws BeanException;

    /**
     * 处理属性值
     * @param pvs
     * @param bean
     * @param beanName
     * @return
     * @throws BeanException
     */
    PropertyValues postProcessPropertyValues(PropertyValues pvs,Object bean,String beanName) throws BeanException;

    /**
     * 给前面的ObjectFactory生产bean，如果子类不进行复写，则默认返回bean本身
     * @param bean
     * @param beanName
     * @return
     */
    default Object getEarlyBeanReference(Object bean,String beanName){
        return bean;
    }

}
